package com.chinaunicom.emergency.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

/**
 * @author liliang
 * @date 2019-12-13
 * redis健康检查自定义
 */
@Component
public class RedisHealthIndicator implements HealthIndicator {

    @Value("${spring.redis.cluster.nodes:null}")
    private String clusterNodes;

    @Override
    public Health health() {
        if("null".equals(clusterNodes)){
            return Health.up().build();
        }
        //TODO 做真正的redis健康检查
        return Health.up().build();
    }
}
